<?php

namespace api\ygzc\model;

use think\Model;

class GoodsModel extends Model
{
    
	/**
     * 模型名称
     * @var string
     */
    protected $name = 'goods';
	/**
     * 基础查询
     * @var string
     */
	protected function base($query){   
        $query -> where('delete_time',0);
    }
	
	public function cate()
    {
		return $this->hasOne('GoodsCategoryModel','id' ,'cate_id')->bind(['cate_name'=>'name']); 
    }

    /**
     * CreateTime 自动转化
     * @param $value
     * @return string
     */
	public function getCreateTimeAttr($value)
    {
        return date('Y-m-d H:i',$value);
    }
	
}
